#ifndef INPUT_BUFFER_H
#define INPUT_BUFFER_H

#define INPUT_BUFFER_SIZE 1023

/**	Buffers input for the provided file descriptor. Passes lines (delimited by '\n')
	to the provided function pointer (handle_line).
*/
class InputBuffer
{
	int fd;
	char buf[INPUT_BUFFER_SIZE];
	unsigned int cur;
	
	void *instance;	// (Optionally) the instance that handle line is a member of
	void (*handle_line)(const char *);

public:
	InputBuffer(int fd, void (*handle_line)(const char *));
	void process(); 	// Attempts to read from FD and process a line
};

#endif
